<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <link rel="stylesheet" href="swiper-master/package/swiper-bundle.min.css">
    <link rel="stylesheet" href="css/index.css">
    <script src="swiper-master/package/swiper-bundle.min.js"></script>
    <script src="js/jquery-1.10.1.js"></script>
    <script src="js/template.js"></script>
</head>

<body>
    <div class="wrap">
        <header>
            <ul class="list">
                <li>网站首页</li>
                <li>党网 时政</li>
                <li>经济 科技</li>
                <li>社会 法治</li>
                <li>健康 生活</li>
                <li>观点</li>
                <li>访谈</li>
                <li>国际</li>
                <li>军事</li>
                <li>港澳</li>
                <li>台湾</li>
                <li>视频</li>
                <li>图片</li>
                <li>教育</li>
                <li>房产</li>
                <li class="dl">登录</li>
                <li>注册</li>
            </ul>
        </header>
        <section>

        </section>
        <div class="box">
            <div class="swiper-container lbt">
                <div class="swiper-wrapper">
                    <div class="swiper-slide"><img src="image/2.jpg" alt=""></div>
                    <div class="swiper-slide"><img src="image/3.jpg" alt=""></div>
                    <div class="swiper-slide"><img src="image/4.jpg" alt=""></div>
                    <div class="swiper-slide"><img src="image/5.jpg" alt=""></div>
                    <div class="swiper-slide"><img src="image/6.jpg" alt=""></div>
                    <div class="swiper-slide"><img src="image/7.jpg" alt=""></div>
                </div>
                <div class="swiper-button-next"></div>
                <div class="swiper-button-prev"></div>
            </div>

        </div>
        <div class="tuijian">

        </div>
        <div class="fenye">
            <ul class="list">

                
            <script type="text/html" id="art01">
                <!-- 遍历 相当于for循环 -->
                {{each data as el index }}
            <li>
                <p>{{el.sj1_text}}</p>
                <p>{{el.sj1_text2}}</p>
            </li>
            {{/each}}
            </script>
        </ul>
            <div class="num">
            </div>
            <div class="pre">上一页</div>
            <div class="next">
                下一页
            </div>
        </div>
    </div>

    <script>
        let promise = new Promise((resolve, reject) => {
            $.ajax({
                method: "get",
                url: "js/1.JSON",
                success(data) {
                    resolve(data);
                },
                error(err) {
                    reject(err)
                }
            })
        })
            ; (async () => {
                let data = await promise;
                console.log(data);
                data.forEach((el) => {
                    $('section').append(`
                    <div class="pho">
                        <img src="${el.header_img1}" alt="">
                        <img src="${el.header_img2}" alt="">
                    </div>
                    <div class="pho2">
                        <img src="${el.header_img3}" alt="">
                        <span class="s1">社会 法治</span>
                        <input type="text" placeholder=" 新 闻 检 索">
                    
                    </div>
                    <ul class="nav">
                        <li>${el.nav_text1}</li>
                        <li>${el.nav_text2}</li>
                        <li>${el.nav_text3}</li>
                        <li>${el.nav_text4}</li>
                        <li>${el.nav_text5}</li>
                        <li>${el.nav_text6}</li>
                        <li>${el.nav_text7}</li>
                        <li>${el.nav_text8}</li>
                        <li>${el.nav_text9}</li>
                        <li>${el.nav_text10}</li>
                    </ul>
                    <div class="text">
                        <p>${el.text1}</p>
                        <p>${el.text2}</p>
                    </div>
                    `)
                    $('.box').append(`
                    <div class="right">
                        <ul class="nav1">
                            <li>${el.right_nav1_text1}</li>
                            <li><span></span>${el.right_nav1_text2}</li>
                            <li><span></span>${el.right_nav1_text3}</li>
                            <li><span></span>${el.right_nav1_text4}</li>
                            <li><span></span>${el.right_nav1_text5}</li>
                            <li><span></span>${el.right_nav1_text6}</li>
                        </ul>
                        <ul class="nav2">
                            <li>${el.right_nav2_text1}</li>
                            <li><span></span>${el.right_nav2_text2}</li>
                            <li><span></span>${el.right_nav2_text3}</li>
                            <li><span></span>${el.right_nav2_text4}</li>
                            <li><span></span>${el.right_nav2_text5}</li>
                            <li><span></span>${el.right_nav2_text6}</li>
                        </ul>
                    </div>
                    `)
                    $('.tuijian').append(`
                        <p>${el.tuijian}<p>
                    `)
                })
            })();


        let promise2 = new Promise((resolve, reject) => {
            $.ajax({
                method: 'get',
                url: "js/fenye.JSON",
                success(data) {
                    resolve(data)
                },
                error(err) {
                    reject(err)
                }
            })
        })
        let index 
            ; (async () => {
                let data = await promise2;
                console.log(data);
                let item=4;
                let page=Math.ceil(data.length/item);
                console.log(page);
                for (var i = 0; i < page; i++) {
                    $('.num').append(`<span>${i+1}</span>`)
                }
            })()
    </script>
    <script>
        var swiper = new Swiper('.swiper-container', {
            navigation: {
                nextEl: '.swiper-button-next',
                prevEl: '.swiper-button-prev',
            },
        });
    </script>
</body>

</html>